<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cairo Interaction</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="index.html" title="GDK Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk-Pango-Interaction.html" title="Pango Interaction">
<link rel="next" href="gdk-X-Window-System-Interaction.html" title="X Window System Interaction">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="reference" href="reference.html" title="API Reference">
<link rel="index" href="api-index-full.html" title="Index of all symbols">
<link rel="index" href="api-index-deprecated.html" title="Index of deprecated symbols">
<link rel="index" href="api-index-2-2.html" title="Index of new symbols in 2.2">
<link rel="index" href="api-index-2-4.html" title="Index of new symbols in 2.4">
<link rel="index" href="api-index-2-6.html" title="Index of new symbols in 2.6">
<link rel="index" href="api-index-2-8.html" title="Index of new symbols in 2.8">
<link rel="index" href="api-index-2-10.html" title="Index of new symbols in 2.10">
<link rel="index" href="api-index-2-12.html" title="Index of new symbols in 2.12">
<link rel="index" href="api-index-2-14.html" title="Index of new symbols in 2.14">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Pango-Interaction.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK Reference Manual</th>
<td><a accesskey="n" href="gdk-X-Window-System-Interaction.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-Cairo-Interaction.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#gdk-Cairo-Interaction.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="gdk-Cairo-Interaction"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-Cairo-Interaction.top_of_page"></a>Cairo Interaction</span></h2>
<p>Cairo Interaction — Functions to support using Cairo</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-Cairo-Interaction.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;gdk/gdk.h&gt;

<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *           <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-create" title="gdk_cairo_create ()">gdk_cairo_create</a>                    (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable);
void                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-set-source-color" title="gdk_cairo_set_source_color ()">gdk_cairo_set_source_color</a>          (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor">GdkColor</a> *color);
void                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-set-source-pixbuf" title="gdk_cairo_set_source_pixbuf ()">gdk_cairo_set_source_pixbuf</a>         (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a
href="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
                                                         double pixbuf_x,
                                                         double pixbuf_y);
void                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-set-source-pixmap" title="gdk_cairo_set_source_pixmap ()">gdk_cairo_set_source_pixmap</a>         (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *pixmap,
                                                         double pixmap_x,
                                                         double pixmap_y);
void                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-rectangle" title="gdk_cairo_rectangle ()">gdk_cairo_rectangle</a>                 (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle">GdkRectangle</a> *rectangle);
void                <a class="link" href="gdk-Cairo-Interaction.html#gdk-cairo-region" title="gdk_cairo_region ()">gdk_cairo_region</a>                    (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion">GdkRegion</a> *region);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="gdk-Cairo-Interaction.description"></a><h2>Description</h2>
<p>
Cairo is a graphics
library that supports vector graphics and image compositing that
can be used with GDK. Since 2.8, GTK+ does most of its drawing
using Cairo.
</p>
<p>
GDK does not wrap the Cairo API, instead it allows to create Cairo
contexts which can be used to draw on GDK drawables. Additional
functions allow to convert GDK's rectangles and regions into
Cairo paths and to use pixbufs as sources for drawing operations.
</p>
</div>
<div class="refsect1" lang="en">
<a name="gdk-Cairo-Interaction.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="gdk-cairo-create"></a><h3>gdk_cairo_create ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *           gdk_cairo_create                    (<a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable">GdkDrawable</a> *drawable);</pre>
<p>
Creates a Cairo context for drawing to <em class="parameter"><code>drawable</code></em>.
</p>
<p>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Note that due to double-buffering, Cairo contexts created 
in a GTK+ expose event handler cannot be cached and reused 
between different expose events. 
</p>
</div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>drawable</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Drawing-Primitives.html#GdkDrawable"><span class="type">GdkDrawable</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> A newly created Cairo context. Free with
 <a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-destroy"
><code class="function">cairo_destroy()</code></a> when you are done drawing.

</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-cairo-set-source-color"></a><h3>gdk_cairo_set_source_color ()</h3>
<pre class="programlisting">void                gdk_cairo_set_source_color          (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor">GdkColor</a> *color);</pre>
<p>
Sets the specified <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a> as the source color of <em class="parameter"><code>cr</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td> a <a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>color</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColor" title="GdkColor"><span class="type">GdkColor</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-cairo-set-source-pixbuf"></a><h3>gdk_cairo_set_source_pixbuf ()</h3>
<pre class="programlisting">void                gdk_cairo_set_source_pixbuf         (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a
href="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
>GdkPixbuf</a> *pixbuf,
                                                         double pixbuf_x,
                                                         double pixbuf_y);</pre>
<p>
Sets the given pixbuf as the source pattern for the Cairo context.
The pattern has an extend mode of <code class="literal">CAIRO_EXTEND_NONE</code> and is aligned
so that the origin of <em class="parameter"><code>pixbuf</code></em> is <em class="parameter"><code>pixbuf_x</code></em>, <em class="parameter"><code>pixbuf_y</code></em></p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td> a <span class="type">Cairo</span> context
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf</code></em> :</span></p></td>
<td> a <a
href="/usr/share/gtk-doc/html/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"
><span class="type">GdkPixbuf</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf_x</code></em> :</span></p></td>
<td> X coordinate of location to place upper left corner of <em class="parameter"><code>pixbuf</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixbuf_y</code></em> :</span></p></td>
<td> Y coordinate of location to place upper left corner of <em class="parameter"><code>pixbuf</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-cairo-set-source-pixmap"></a><h3>gdk_cairo_set_source_pixmap ()</h3>
<pre class="programlisting">void                gdk_cairo_set_source_pixmap         (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap">GdkPixmap</a> *pixmap,
                                                         double pixmap_x,
                                                         double pixmap_y);</pre>
<p>
Sets the given pixmap as the source pattern for the Cairo context.
The pattern has an extend mode of <code class="literal">CAIRO_EXTEND_NONE</code> and is aligned
so that the origin of <em class="parameter"><code>pixmap</code></em> is <em class="parameter"><code>pixmap_x</code></em>, <em class="parameter"><code>pixmap_y</code></em></p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td> a <span class="type">Cairo</span> context
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Bitmaps-and-Pixmaps.html#GdkPixmap"><span class="type">GdkPixmap</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap_x</code></em> :</span></p></td>
<td> X coordinate of location to place upper left corner of <em class="parameter"><code>pixmap</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>pixmap_y</code></em> :</span></p></td>
<td> Y coordinate of location to place upper left corner of <em class="parameter"><code>pixmap</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-cairo-rectangle"></a><h3>gdk_cairo_rectangle ()</h3>
<pre class="programlisting">void                gdk_cairo_rectangle                 (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle">GdkRectangle</a> *rectangle);</pre>
<p>
Adds the given rectangle to the current path of <em class="parameter"><code>cr</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td> a <a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>rectangle</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRectangle" title="GdkRectangle"><span class="type">GdkRectangle</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="gdk-cairo-region"></a><h3>gdk_cairo_region ()</h3>
<pre class="programlisting">void                gdk_cairo_region                    (<a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
>cairo_t</a> *cr,
                                                         const <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion">GdkRegion</a> *region);</pre>
<p>
Adds the given region to the current path of <em class="parameter"><code>cr</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>cr</code></em> :</span></p></td>
<td> a <a
href="/usr/share/gtk-doc/html/cairo/cairo-context.html#cairo-t"
><span class="type">cairo_t</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>region</code></em> :</span></p></td>
<td> a <a class="link" href="gdk-Points-Rectangles-and-Regions.html#GdkRegion" title="GdkRegion"><span class="type">GdkRegion</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.8</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>
